package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.performance;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 绩效管理- 每日总积分表
 */
@Data
@Entity
@Table(name = "t_day_performance")
@org.hibernate.annotations.Table(appliesTo = "t_day_performance", comment = "绩效管理-每日总积分表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DayPerformance implements Serializable {
    private static final long serialVersionUID = 265618201337330252L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(20) comment 'id'")
    private Integer id;

    @Column(name = "user_id", columnDefinition = "int DEFAULT NULL COMMENT '员工id'")
    @ApiModelProperty(value = "员工id")
    private Integer userId;

    @ApiModelProperty(value = "员工名称 ")
    @Column(name = "user_name", columnDefinition = "varchar(255) COMMENT '员工名称'")
    private String userName;

    @ApiModelProperty(value = "员工oa账号")
    @Column(name = "user_oa_account", columnDefinition = "varchar(255) comment '员工oa账号'")
    private String userOaAccount;

    @ApiModelProperty(value = "岗位名称")
    @Column(name = "post_name", columnDefinition = "varchar(255) COMMENT '岗位名称'")
    private String postName;

    @ApiModelProperty(value = "有效工时/min")
    @Column(name = "man_hour", columnDefinition = "int DEFAULT NULL COMMENT '今日工时'")
    private Integer manHour;

    @ApiModelProperty(value = "主动工时/min")
    @Column(name = "accord_hour", columnDefinition = "int DEFAULT NULL COMMENT '主动工时'")
    private Integer accordHour;

    @ApiModelProperty(value = "被动动工时/min")
    @Column(name = "passive_hour", columnDefinition = "int DEFAULT NULL COMMENT '被动动工时'")
    private Integer passiveHour;

    @ApiModelProperty(value = "生效日期")
    @Column(name = "effect_date", columnDefinition = "varchar(255) COMMENT '生效日期yyyy-MM-dd'")
    private String effectDate;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;



    @Transient
    @ApiModelProperty(value = "开始时间 yyyy-MM-dd HH:mm:ss")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime startTime;

    @Transient
    @ApiModelProperty(value = "结束时间 yyyy-MM-dd HH:mm:ss")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime endTime;
}
